// 订单列表信息模型
class MainOrderListModel {
  int code;
  String msg;
  String time;
  List<MainOrderCellModel> data;

  MainOrderListModel({this.code, this.msg, this.time, this.data});

  MainOrderListModel.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    msg = json['msg'];
    time = json['time'];
    if (json['data'] != null) {
      data = new List<MainOrderCellModel>();
      json['data'].forEach((v) {
        data.add(new MainOrderCellModel.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['msg'] = this.msg;
    data['time'] = this.time;
    if (this.data != null) {
      data['data'] = this.data.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

// 订单列表模型
class MainOrderCellModel {
  int id;
  int orderStatus;
  String sCity;
  String sArea;
  String sTown;
  String sAddress;
  String sTitle;
  String rCity;
  String rArea;
  String rTown;
  String rAddress;
  String rTitle;
  String goodsRemark;
  int createtime;
  String orderPrice;
  String reciveOrderTime;
  double distance;
  String pickUpTime;
  String sendToTime;
  String createtimeText;
  String delivergoodstime;
  double csDistance;

  MainOrderCellModel({
    this.id,
    this.orderStatus,
    this.sCity,
    this.sArea,
    this.sTown,
    this.sAddress,
    this.sTitle,
    this.rCity,
    this.rArea,
    this.rTown,
    this.rAddress,
    this.rTitle,
    this.goodsRemark,
    this.createtime,
    this.orderPrice,
    this.reciveOrderTime,
    this.distance,
    this.pickUpTime,
    this.sendToTime,
    this.createtimeText,
    this.delivergoodstime,
    this.csDistance,
  });

  MainOrderCellModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    orderStatus = json['order_status'];
    sCity = json['s_city'];
    sArea = json['s_area'];
    sTown = json['s_town'];
    sAddress = json['s_address'];
    sTitle = json['s_title'];
    rCity = json['r_city'];
    rArea = json['r_area'];
    rTown = json['r_town'];
    rAddress = json['r_address'];
    rTitle = json['r_title'];
    goodsRemark = json['goods_remark'];
    createtime = json['createtime'];
    orderPrice = json['order_price'];
    reciveOrderTime = json['recive_order_time'];
    if (json['distance'] != null) {
      distance = double.parse(json['distance'].toString());
    }
    pickUpTime = json['pick_up_time'];
    sendToTime = json['send_to_time'];
    createtimeText = json['createtime_text'];
    delivergoodstime = json['deliver_goods_time'];
    if (json['cs_distance'] != null) {
      csDistance = double.parse(json['cs_distance'].toString());
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['order_status'] = this.orderStatus;
    data['s_city'] = this.sCity;
    data['s_area'] = this.sArea;
    data['s_town'] = this.sTown;
    data['s_address'] = this.sAddress;
    data['s_title'] = this.sTitle;
    data['r_city'] = this.rCity;
    data['r_area'] = this.rArea;
    data['r_town'] = this.rTown;
    data['r_address'] = this.rAddress;
    data['r_title'] = this.rTitle;
    data['goods_remark'] = this.goodsRemark;
    data['createtime'] = this.createtime;
    data['order_price'] = this.orderPrice;
    data['recive_order_time'] = this.reciveOrderTime;
    data['distance'] = this.distance;
    data['pick_up_time'] = this.pickUpTime;
    data['send_to_time'] = this.sendToTime;
    data['createtime_text'] = this.createtimeText;
    data['deliver_goods_time'] = this.delivergoodstime;
    data['cs_distance'] = this.csDistance;
    return data;
  }
}

// 订单详情模型
class MainOrderNewsModel {
  int code;
  String msg;
  String time;
  Data data;

  MainOrderNewsModel({this.code, this.msg, this.time, this.data});

  MainOrderNewsModel.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    msg = json['msg'];
    time = json['time'];
    data = json['data'] != null ? new Data.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['msg'] = this.msg;
    data['time'] = this.time;
    if (this.data != null) {
      data['data'] = this.data.toJson();
    }
    return data;
  }
}

class Data {
  int id;
  String orderNumber;
  int sendAddressId;
  int reciveAddressId;
  String sCity;
  String sArea;
  String sAddress;
  String sBuildingNumber;
  String sRealname;
  String sMobile;
  String sTitle;
  String rCity;
  String rArea;
  String rTitle;
  String rAddress;
  String rBuildingNumber;
  String rRealname;
  String rMobile;
  String goodsRemark;
  String csGoodsName;
  int csGoodsNumber;
  String bsGoodsName;
  int bsGoodsNumber;
  String otherGoodsName;
  int createtime;
  String reciveOrderTime;
  String pickUpTime;
  String sendToTime;
  String orderPrice;
  String realname;
  String carNumber;
  int carUserId;
  String mobile;
  int orderStatus;
  String avatar;
  String sLat;
  String sLng;
  String rLat;
  String rLng;
  int payStatus;
  int payType;
  int isDeliveryPay; //1 到付
  String codeImage;
  String comment;
  String createtimeText;
  String delivergoodstime;

  Data(
      {this.id,
      this.orderNumber,
      this.sendAddressId,
      this.reciveAddressId,
      this.sCity,
      this.sArea,
      this.sAddress,
      this.sBuildingNumber,
      this.sRealname,
      this.sMobile,
      this.sTitle,
      this.rCity,
      this.rArea,
      this.rTitle,
      this.rAddress,
      this.rBuildingNumber,
      this.rRealname,
      this.rMobile,
      this.goodsRemark,
      this.csGoodsName,
      this.csGoodsNumber,
      this.bsGoodsName,
      this.bsGoodsNumber,
      this.otherGoodsName,
      this.createtime,
      this.reciveOrderTime,
      this.pickUpTime,
      this.sendToTime,
      this.orderPrice,
      this.realname,
      this.carNumber,
      this.carUserId,
      this.mobile,
      this.orderStatus,
      this.avatar,
      this.sLat,
      this.sLng,
      this.rLat,
      this.rLng,
      this.payStatus,
      this.payType,
      this.isDeliveryPay,
      this.codeImage,
      this.comment,
      this.createtimeText,
      this.delivergoodstime});

  Data.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    orderNumber = json['order_number'];
    sendAddressId = json['send_address_id'];
    reciveAddressId = json['recive_address_id'];
    sCity = json['s_city'];
    sArea = json['s_area'];
    sAddress = json['s_address'];
    sBuildingNumber = json['s_building_number'];
    sRealname = json['s_realname'];
    sMobile = json['s_mobile'];
    sTitle = json['s_title'];
    rCity = json['r_city'];
    rArea = json['r_area'];
    rTitle = json['r_title'];
    rAddress = json['r_address'];
    rBuildingNumber = json['r_building_number'];
    rRealname = json['r_realname'];
    rMobile = json['r_mobile'];
    goodsRemark = json['goods_remark'];
    csGoodsName = json['cs_goods_name'];
    csGoodsNumber = json['cs_goods_number'];
    bsGoodsName = json['bs_goods_name'];
    bsGoodsNumber = json['bs_goods_number'];
    otherGoodsName = json['other_goods_name'];
    createtime = json['createtime'];
    reciveOrderTime = json['recive_order_time'];
    pickUpTime = json['pick_up_time'];
    sendToTime = json['send_to_time'];
    orderPrice = json['order_price'];
    realname = json['realname'];
    carNumber = json['car_number'];
    carUserId = json['car_user_id'];
    mobile = json['mobile'];
    orderStatus = json['order_status'];
    avatar = json['avatar'];
    sLat = json['s_lat'];
    sLng = json['s_lng'];
    rLat = json['r_lat'];
    rLng = json['r_lng'];
    payStatus = json['pay_status'];
    payType = json['pay_type'];
    isDeliveryPay = json['is_delivery_pay'];
    codeImage = json['code_image'];
    comment = json['comment'];
    createtimeText = json['createtime_text'];
    delivergoodstime = json['deliver_goods_time'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['order_number'] = this.orderNumber;
    data['send_address_id'] = this.sendAddressId;
    data['recive_address_id'] = this.reciveAddressId;
    data['s_city'] = this.sCity;
    data['s_area'] = this.sArea;
    data['s_address'] = this.sAddress;
    data['s_building_number'] = this.sBuildingNumber;
    data['s_realname'] = this.sRealname;
    data['s_mobile'] = this.sMobile;
    data['s_title'] = this.sTitle;
    data['r_city'] = this.rCity;
    data['r_area'] = this.rArea;
    data['r_title'] = this.rTitle;
    data['r_address'] = this.rAddress;
    data['r_building_number'] = this.rBuildingNumber;
    data['r_realname'] = this.rRealname;
    data['r_mobile'] = this.rMobile;
    data['goods_remark'] = this.goodsRemark;
    data['cs_goods_name'] = this.csGoodsName;
    data['cs_goods_number'] = this.csGoodsNumber;
    data['bs_goods_name'] = this.bsGoodsName;
    data['bs_goods_number'] = this.bsGoodsNumber;
    data['other_goods_name'] = this.otherGoodsName;
    data['createtime'] = this.createtime;
    data['recive_order_time'] = this.reciveOrderTime;
    data['pick_up_time'] = this.pickUpTime;
    data['send_to_time'] = this.sendToTime;
    data['order_price'] = this.orderPrice;
    data['realname'] = this.realname;
    data['car_number'] = this.carNumber;
    data['car_user_id'] = this.carUserId;
    data['mobile'] = this.mobile;
    data['order_status'] = this.orderStatus;
    data['avatar'] = this.avatar;
    data['s_lat'] = this.sLat;
    data['s_lng'] = this.sLng;
    data['r_lat'] = this.rLat;
    data['r_lng'] = this.rLng;
    data['pay_status'] = this.payStatus;
    data['pay_type'] = this.payType;
    data['is_delivery_pay'] = this.isDeliveryPay;
    data['code_image'] = this.codeImage;
    data['comment'] = this.comment;
    data['createtime_text'] = this.createtimeText;
    data['deliver_goods_time'] = this.delivergoodstime;
    return data;
  }
}
